import { Controller, Post, Body, Req, BadRequestException } from '@nestjs/common';
import { Request } from '@common/auth';
import { PhotosProfileService } from './photosProfile.service';
import { isMongoId } from 'class-validator';
import { DownloadPhotosProfileDto } from './dto/download-photosProfile.dto';
import { HotListPhotosProfileDto } from './dto/hotList-photosProfile.dto';

@Controller()
export class PhotosProfileController {
    constructor(private readonly photosProfileService: PhotosProfileService) {}

    @Post('/photosProfile/download')
    downItem(@Body() dto: DownloadPhotosProfileDto) {
        if (!isMongoId(dto.photosId)) {
            throw new BadRequestException('id错误！');
        }
        return this.photosProfileService.downItem(dto.photosId);
    }
    @Post('/photosProfile/hotList')
    hotList(@Body() dto: HotListPhotosProfileDto) {
        return this.photosProfileService.hotList(dto);
    }
    @Post('/photosProfile/findList')
    findList(@Body() dto: HotListPhotosProfileDto) {
        return this.photosProfileService.findList(dto);
    }
}
